<template>
	<view>
		<button @click="pullDown">点击下拉刷新</button>
		<button @click="reset">重置</button>
		<view style="height: 250rpx;" v-for="(item, index) in list" :key="index">{{ item }}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: ['张三', '李四', '王五', '赵六', 'a', 'b', 'c', 'd']
			};
		},
		onPullDownRefresh() {
			setTimeout(() => {
				this.list = ['java', 'C#', 'python', 'javascript', 'C'];
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom() {
			uni.showToast({
				title: '已经到底了'
			});
			this.list.push('张三', '李四', '王五', '赵六', 'a', 'b', 'c', 'd')
		},
		methods: {
			pullDown() {
				uni.startPullDownRefresh();
			},
			reset() {
				this.list = ['张三', '李四', '王五', '赵六'];
			}
		}
	};
</script>